local manlou = fk.CreateSkill{
  name = "hanqing__manlou",
}

Fk:loadTranslationTable{
  ["hanqing__manlou"] = "满楼",
  [":hanqing__manlou"] = "出牌阶段，你可以令一名角色获得场上所有“狂风”标记，然后所有失去“狂风”标记的其他角色移出游戏至本回合结束。",

  ["#hanqing__manlou"] = "满楼：令一名角色获得场上所有“狂风”标记，失去标记的角色本回合移出游戏！",

  ["$hanqing__manlou1"] = "避横山，穿孔隙，聚散无常，兵法形焉。",
  ["$hanqing__manlou2"] = "大军利涉，全师既行，敌国奄有死难之志？",
}

local DIY = require("packages/diy_utility/diy_utility")

manlou:addEffect("active", {
  anim_type = "control",
  prompt =  "#hanqing__manlou",
  card_num = 0,
  target_num = 1,
  can_use = function (self, player)
    return table.find(Fk:currentRoom().alive_players, function (p)
      return p:getMark("@@kuangfeng") > 0
    end)
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected, selected_cards)
    if #selected == 0 and not to_select:isRemoved() then
      for _, p in ipairs(Fk:currentRoom().alive_players) do
        if p ~= to_select and p:getMark("@@kuangfeng") > 0 then
          return true
        end
      end
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:delay(1600)
    for _, p in ipairs(room:getOtherPlayers(target)) do
      if p:getMark("@@kuangfeng") > 0 then
        room:doIndicate(player, {p})
        room:addPlayerMark(target, "@@kuangfeng", p:getMark("@@kuangfeng"))
        room:setPlayerMark(p, "@@kuangfeng", 0)
        if p ~= player then
          DIY.removePlayer(p, "-turn")
        end
      end
    end
  end,
})

return manlou
